package com.qiwenshare.ufop.util;

/**
 * @author MAC
 * @version 1.0
 */
public class IdUtils {

    private IdUtils() {
        throw new UnsupportedOperationException("Cannot instantiate utility class");
    }

    public static String generateRevisionId(String expectedKey) {

        if (expectedKey.length() > 20) {
            expectedKey = Integer.toString(expectedKey.hashCode());
        }

        String key = expectedKey.replace("[^0-9-.a-zA-Z_=]", "_");

        return key.substring(0, Math.min(key.length(), 20));
    }
}
